package com.lagou.util;

/**
 * http协议工具类，主要提供响应头
 */
public class HttpProtocolUtil {

    public static String httpResponseHeader200(int contentLength){
        return "HTTP/1.1 200 OK \n" +
                "Content-Type: text/html; charset=UTF-8 \n" +
                "Content-Length: " + contentLength + "\n" +
                "\r\n";
    }

    public static String httpResponseHeader404(){
        String text = "<h1>资源没有找到</h1>";
        return "HTTP/1.1 404 Not Found \n" +
                "Content-Type: text/html; charset=UTF-8 \n" +
                "Content-Length: " + 27 + "\n" +
                "\r\n" + text;
    }
}
